<template>
  <div>
    <h3>用户新增</h3>
    <div>用户名称 <input v-model="username" /></div>
    <div>用户年龄 <input v-model="userage" /></div>
    <button @click="add">新增</button>
  </div>
</template>

<script>
import  {mapActions} from "vuex";
export default {
    data(){
        return  {
            username:"",
            userage:""
        }
    },
    methods:{
        ...mapActions("user",["addListItem"]),
        add(){
            //alert(this.username+"和"+this.userage);
            this.addListItem({
                username:this.username,
                userage:this.userage
            }).then(res=>{
                console.log(res);
            })

        }

    }
};
</script>

<style></style>
